import React, { useEffect, useState } from "react";
import { useParams, useNavigate } from "react-router-dom";
import { lodaDetailApI } from "../../services/list";
import { Image, NavBar } from "antd-mobile";

function Detail() {
  const params = useParams();
  const nav = useNavigate();
  // console.log(params);
  const [info, setInfo] = useState({});
  useEffect(() => {
    lodaDetailApI(params.id).then((res) => setInfo(res.data));
  }, []);
  const back = () => nav("/lists");
  return (
    <>
      <NavBar onBack={back}>好大夫</NavBar>
      <h1>{info.name}</h1>
      <Image src={info.avatar} />
    </>
  );
}

export default Detail;
